/* The file is saved in UTF-8 codepage.
 * Check: «Stereotype», Section mark-§, Copyright-©, Alpha-α, Beta-β, Smile-☺
 */
package cz.pecinovsky.english.lootp._115_;

import cz.pecinovsky.english.lootp._parents._ICar_116_119;
import cz.pecinovsky.english.lootp.manager.Ellipse;
import cz.pecinovsky.english.lootp.manager.IPaintable;
import cz.pecinovsky.english.lootp.manager.Painter;
import cz.pecinovsky.english.lootp.manager.Rectangle;

import cz.pecinovsky.english.lootp.utility.NamedColor;

// %I+ <119
//import cz.pecinovsky.english.lootp.shapes.Ellipse;
//import cz.pecinovsky.english.lootp.shapes.Rectangle;
// %I-



//import cz.pecinovsky.english.lootp._115_.Car_116_119.Car;
////////////////////////////////////////////////////////////////////////////////
//%%+  +++++ End of ignored starting test - place for imports +++++

//%X+ xxxxx Start of the ovejumped text with declaration of the envelope xxxxx
/*******************************************************************************
 *<pre>
 * Previous:  No - this is a newly defined class
 * Following: {@link cz.pecinovsky.english.lootp._115_.Auto_120_124}
 *
 * Project  016z_02_Tvary
 *   + Two constructors
 *
 *</pre>
 *
 * @author Rudolf PECINOVSKÝ
 * @version 6.03.2017 — 2010-11-08
 */
public class Car_116_119
{    private Car_116_119() {}   static
////////////////////////////////////////////////////////////////////////////////
//%X- ----- End of the ovejumped text with declaration of the envelope -----


//%I+ <119
//public class Car
//%I-
//%X+ <119
public class Car implements IPaintable
//%X-
//%A+ <0
        ,   _ICar_116_119
//%A-
{
//%X+ <118
    private Rectangle chassis;
    private Rectangle cab;
    private Ellipse   lightL;
    private Ellipse   lightR;


//%X-
    public Car()
    {
//%I+ <118
//        new Rectangle(  0,  0, 128, 64, NamedColor.BLUE);
//        new Rectangle( 16, 16,  64, 32, NamedColor.GRAY);
//        new Ellipse  (112,  0,  16, 16, NamedColor.YELLOW);
//        new Ellipse  (112, 48,  16, 16, NamedColor.YELLOW);
//%I-
//%X+ <118
        chassis = new Rectangle(  0,  0, 128, 64, NamedColor.BLUE);
        cab     = new Rectangle( 16, 16,  64, 32, NamedColor.GRAY);
        lightL  = new Ellipse  (112,  0,  16, 16, NamedColor.YELLOW);
        lightR  = new Ellipse  (112, 48,  16, 16, NamedColor.YELLOW);
//%X-
    }
//%X+ <117


    public Car(int x, int y)
    {
//%X-
//%I+ =117z
//        new Rectangle(x+  0, y+ 0, 128, 64, NamedColor.BLUE);
//        new Rectangle(x+ 16, y+16,  64, 32, NamedColor.GRAY);
//        new Ellipse  (x+112, y+ 0,  16, 16, NamedColor.YELLOW);
//        new Ellipse  (x+112, y+48,  16, 16, NamedColor.YELLOW);
//%I-
//%X+ <118
        chassis = new Rectangle(x+  0, y+ 0, 128, 64, NamedColor.BLUE);
        cab     = new Rectangle(x+ 16, y+16,  64, 32, NamedColor.GRAY);
        lightL  = new Ellipse  (x+112, y+ 0,  16, 16, NamedColor.YELLOW);
        lightR  = new Ellipse  (x+112, y+48,  16, 16, NamedColor.YELLOW);
//%X-
//%X+ <117
    }


    public Car(int x, int y, NamedColor chassisColor)
    {
//%X-
//%I+ =117z
//        new Rectangle(x+  0, y+ 0, 128, 64, chassisColor);
//        new Rectangle(x+ 16, y+16,  64, 32, NamedColor.GRAY);
//        new Ellipse  (x+112, y+ 0,  16, 16, NamedColor.YELLOW);
//        new Ellipse  (x+112, y+48,  16, 16, NamedColor.YELLOW);
//    }
//%I-
//%X+ <118
        chassis = new Rectangle(x+  0, y+ 0, 128, 64, chassisColor);
        cab     = new Rectangle(x+ 16, y+16,  64, 32, NamedColor.GRAY);
        lightL  = new Ellipse  (x+112, y+ 0,  16, 16, NamedColor.YELLOW);
        lightR  = new Ellipse  (x+112, y+48,  16, 16, NamedColor.YELLOW);
    }
//%X-
//%X+ <119


    /***************************************************************************
     * Prostřednictvím dodaného kreslítka vykreslí obraz své instance.
     *
     * @param painter Painter, které nakreslí instanci
     */
    @Override
    public void paint(Painter painter)
    {
        chassis.paint(painter);
        cab    .paint(painter);
        lightL .paint(painter);
        lightR .paint(painter);
    }
//%X-
    }

//%%- ---- Start of the ovejumped text with closing of the envelope ----
////////////////////////////////////////////////////////////////////////////////
//== TESTING CLASSES AND METHODS ===============================================

    /***************************************************************************
     * Test method.
     */
    public static void test()
    {
        new Car();
        new Car(100, 100);
        new Car(50, 200, NamedColor.BLACK);
//        System.exit(0);
    }
    /** @param args Parametry příkazového řádku - nepoužívané. */
    public static void main(String[] args)  {  test();  }
}
